package com.example.snashuitraverl.demos.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.snashuitraverl.demos.common.ErrorCode;
import com.example.snashuitraverl.demos.domain.Bonus;
import com.example.snashuitraverl.demos.exception.BusinessException;
import com.example.snashuitraverl.demos.service.BonusService;
import com.example.snashuitraverl.demos.mapper.BonusMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
* @author 32551
* @description 针对表【bonus(积分表)】的数据库操作Service实现
* @createDate 2024-07-11 15:09:16
*/
@Service
public class BonusServiceImpl extends ServiceImpl<BonusMapper, Bonus>
    implements BonusService{

    @Resource BonusMapper bonusMapper;

    @Override
    public int addBonus(String openID, String bonusNums) {
//        Bonus openID1 = bonusMapper.selectOne(new QueryWrapper<Bonus>().eq("openID", openID));
//        if(openID1==null){
//            throw new BusinessException(ErrorCode.PARAMS_ERROR,"你还没登陆 你是怎么事？");
//        }
//        int   bonusNewNums;
//        if(bonusNums.equals("倍")){
//         bonusNewNums =Integer.parseInt(bonusNums)*20;
//        }
//        else {
//            bonusNewNums=Integer.parseInt(bonusNums)*2;
//        }
//        Date bonusTime = openID1.getBonusTime();
//        bonusTime.after(new Date());
        return 0;
    }
}




